#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n,m,l,v;cin>>n>>m>>l>>v;
    int d[n],v[n],a[n];
    for(int i=0;i<n;i++)cin>>d[i]>>v[i]>>a[i];
    int p[m];
    for(int i=0;i<m;i++)cin>>p[i];
int main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    int t;cin>>t;
    while(t--)solve();
    return 0;
}
